<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:util="http://java.sun.com/jsf/composite/util"
                xmlns:f="http://java.sun.com/jsf/core" xmlns:pe="http://primefaces.org/ui/extensions">

    <pe:importEnum type="md.mru.frontend.utils.MainContentTypes" var="contentType"/>

    <h:form id="folders_list_form">
        <util:dataTableWrapper title="Lista foldere neatasate">
            <f:facet name="buttonContent">
                <p:commandButton icon="custom-icon-add" value="Adauga dosar nou"
                                 oncomplete="PF('create_folderWV').show()" update=":create_folder_form" resetValues="true"
                                 actionListener="#{folderAdministrationBean.resetCreateFolderDialog()}"/>
            </f:facet>

            <f:facet name="rightContent">
                <p:outputPanel layout="block">
                    <p:watermark for="search-input" value="cauta dosar dupa:(nume,prenume,idnp)"/>
                    <p:inputText id="search-input" style="width: 240px;margin-right: 5px"/>
                    <p:commandButton value="Cauta"/>
                </p:outputPanel>
            </f:facet>

            <p:dataTable id="folders_data" var="f" value="#{folderAdministrationBean.folders}"
                         emptyMessage="Nu a fost gasita nici o inregistrare."
                         paginator="true" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">

                <p:column headerText="Nume" sortBy="#{f.lastName}">
                    <h:outputText value="#{f.firstName} #{f.lastName} #{f.patronymic}"/>
                </p:column>

                <p:column headerText="IDNP" sortBy="#{f.IDNP}">
                    #{f.IDNP}
                </p:column>

                <p:column styleClass="override-icons" headerText="Actions">
                    <p:commandButton icon="custom-icon-view" value="Vizualizeaza"
                                     actionListener="#{folderAdministrationBean.showFolder(f)}"
                                     update=":main_folder_details :main_content"
                                     oncomplete="displayCenterNorthLayout()">
                        <f:setPropertyActionListener value="#{contentType.FOLDER_DETAILS_CONTENT}"
                                                     target="#{mainContentHandler.currentAccessedContent}"/>
                    </p:commandButton>
                </p:column>

            </p:dataTable>
        </util:dataTableWrapper>
    </h:form>
</ui:composition>